package mail;

import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.SimpleEmail;


public class MailTest {
	public static void main(String[] args) {
		SimpleEmail email = new SimpleEmail();
		email.setHostName("smtp.sina.cn");
		email.setAuthentication("seightday", "123456");
		email.setCharset("UTF-8");
		try {
			email.addTo("674114624@qq.com");
			email.setFrom("seightday@sina.cn");//必须和Authentication使用的用户相同，否则失败
			email.setSubject("haha");
			email.setMsg("---------------------测试");
			email.send();
		} catch (EmailException e) {
			e.printStackTrace();
		}

	}
}
